package com.g9.blog.repository;

import com.g9.blog.entity.Article;
import com.g9.blog.entity.ArticleSort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Auther: Graycat
 * @Date: 2020/9/14 19:53
 * Create by lwj.
 */
public interface ArticleSortRepository extends JpaRepository<ArticleSort,Integer> {

    @Query(" select t from Article t where t.id in " +
            "( select asort.articleId from ArticleSort asort where asort.sortId = ?1 )" )
    public List<Article> findAllArticleBySortId(int sortId );

    ArticleSort findByArticleIdAndSortId(int articleId,int sortId);

}
